package org.iteye.bbjava.dao.impl;

import org.iteye.bbjava.dao.UserDao;
import org.iteye.bbjava.model.User;
import org.iteye.bbjava.util.HibernateGenericDao;

public class UserDaoImpl extends HibernateGenericDao implements UserDao{

	@Override
	public int save(User user) {
		try{
			super.save(user);
		}catch (Exception e) {
			e.printStackTrace();
		}
	
		return 0;
	}

	@Override
	public int update(User user) {
		super.save(user);
		return 0;
	}

	@SuppressWarnings("unchecked")
	@Override
	public int delete(Integer user) {
		super.removeById(User.class,user );
		return 0;
	}

	@Override
	public User queryOne(User user) {
		Object obj = super.get(User.class, user.getId());
		User u = null;
		if(null == obj){
			u = (User)obj;
		}
		return u;
	}


}
